package crawler.torunski;

import com.torunski.crawler.events.ILoadingEventListener;
import com.torunski.crawler.events.LoadingEvent;

import crawler.LinkFilterRepository;

public class URLLoadingListener implements ILoadingEventListener {

	private LinkFilterRepository _repository;
	private String _server;
	public URLLoadingListener(LinkFilterRepository repository, String server) {
		_repository = repository;
		_server = server;
	}

	@Override
	public void afterLoading(LoadingEvent arg0) {
		String link = arg0.getLink().toString();
		_repository.putFor(link,_server);
	}

	@Override
	public void beforeLoading(LoadingEvent arg0) {
		// DO NOTHING
	}

}
